package com.zhengke.controller.bbfx;



import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.zhengke.common.object.Result;
import com.zhengke.dao.bbfx.ServicePointMapper;
import com.zhengke.service.IServicePoint;

@Controller
@RequestMapping("ServicePoint")
public class ServicePointController {
	@Autowired
	private IServicePoint service;
	@Autowired
	private ServicePointMapper dao;
	
	/**
	 * 去往ServicePointLists页面
	 * @return
	 */
	@RequestMapping("queryAreaRank")
	public String toServicePoint(Model model) {

		List<Map<String, Object>> list = dao.findPoint(null);
		model.addAttribute("picList", list);
		
		return "bbfx/ServicePointList";
	}
	
	/**
	 *  去往RunAccount页面
	 * @return
	 */
	@RequestMapping("toRunningAccount")
	public String toRunaccount() {
		
		
		return "bbfx/RunAccount";
	}
	
	//服务点销量排行查询
	@ResponseBody
	@RequestMapping(value="queryPoint",method=RequestMethod.POST)
	public Result queryPoint(String startDate,String endDate,int page,int limit) {
	Result rs = service.findPoint(startDate, endDate,page,limit);
		return rs;
	}
	
	
	
	/**
	 *  服务点流水账查询
	 */
	@ResponseBody
	@RequestMapping(value="queryRunaccount",method=RequestMethod.POST)
	public Result findRunaccount(String startDate,String endDate,int page,int limit) {
		
		Result rs = service.findRunaccount(startDate, endDate, page, limit);
		return rs;
	}
	/**
	 * 导出excel
	 * @param startDate
	 * @param endDate
	 * @param page
	 * @param limit
	 * @param response
	 */
	@RequestMapping("export")
	public void exportExcel(String startDate,String endDate,HttpServletResponse response) {
	service.exportExcel(startDate, endDate, response);
	}
}
